<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>考试页面</title>
    <link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <form class="" method="post" action="/index.php/exam/index/submit">
        <input type="hidden" value="{$exam_paper.exam_id}">{:token()}
{volist name="exam_paper.questions" id="questions"}
    {switch name="key"}
        {case value="q1"}
            <h2>单选题</h2>{/case}
        {case value="q2"}
            <h2>多选题</h2>{/case}
        {case value="q3"}
            <h2>判断题</h2>{/case}
        {case value="q4"}
            <h2>填空题</h2>{/case}
        {/switch}
    {volist name="questions" id="question" key="k"}
        <div><p>{$k.'.'.$question.content}</p>
                {php}
                    $qans=json_decode(htmlspecialchars_decode($question->qans));
                    switch($i){
                        case '1':
                        case '3':

                            foreach($qans as $ans=>$cont){
                                echo '<input name="q'.$i.'.q_'.$k."\" type='radio' value='".$ans.'\'/> '.$ans.':'.$cont.'<br>';
                            }
                            break;
                        case '2':
                            foreach($qans as $ans=>$cont){
                                echo '<input name="q2.q_'.$k."\" type='checkbox' value='".$ans.'\'/> '.$ans.':'.$cont.'<br>';
                            }
                            break;
                        case '5':
                            echo '<input name="q4.q_'.$k."\" type='text' /><br>";
                            break;
                        case '4':
                            echo '<textarea name="q5.q_'.$k."\"  rows='4' cols='100' ></textarea><br>";
                            break;
                    }

                {/php}



        </div>
        {/volist}


    {/volist}
    <button type="submit">提交试卷</button>
    </form>
</div>
</body>
</html>